package tree.递归;

import po.TreeNode;

/**
 * @author songZiHao
 * @version 1.0.0
 * @ClassName 翻转二叉树226.java
 * @Description TODO https://leetcode-cn.com/problems/invert-binary-tree/
 * @createTime 2021年03月24日 21:05:00
 */
public class 翻转二叉树226 {

    public TreeNode invertTree(TreeNode root) {
        if (root == null) {
            return root;
        }
        TreeNode temp=root.left;
        root.left=root.right;
        root.right=temp;
        invertTree(root.left);
        invertTree(root.right);
        return root;
    }
}
